<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let data = [
        {
          value: [113.29631, 23.188776],
          itemStyle: {
            color: "#4ab2e5",
          },
          popupContent: "广州体育馆"
        },
        {
          value: [113.344891, 23.204986],
          itemStyle: {
            color: "#4fb6d2",
          },
          popupContent: "东坑山",
        },
        {
          value: [113.343166, 23.232884],
          itemStyle: {
            color: "#52b9c7",
          },
          popupContent: "南潮高尔夫俱乐部",
        },
        {
          value: [113.352652, 23.193294],
          itemStyle: {
            color: "#5abead",
          },
          popupContent: "南方医科大学",
        },
        {
          value: [113.376511, 23.248027],
          itemStyle: {
            color: "#f34e2b",
          },
          popupContent: "大源洞",
        },
        {
          value: [113.357251, 23.174956],
          itemStyle: {
            color: "#f56321",
          },
          popupContent: "广州天河汽车客运站",
        },
        {
          value: [113.306084, 23.163793],
          itemStyle: {
            color: "#f56f1c",
          },
          popupContent: "云台花园",
        },
      ];

      function generateRandomPhoneNumber() {
        // 常见的中国手机号码前缀
        const prefixes = [
          "130",
          "131",
          "132",
          "133",
          "134",
          "135",
          "136",
          "137",
          "138",
          "139",
          "150",
          "151",
          "152",
          "153",
          "155",
          "156",
          "157",
          "158",
          "159",
          "170",
          "171",
          "172",
          "173",
          "175",
          "176",
          "177",
          "178",
          "180",
          "181",
          "182",
          "183",
          "184",
          "185",
          "186",
          "187",
          "188",
          "189",
        ];

        // 随机选择一个前缀
        const prefix = prefixes[Math.floor(Math.random() * prefixes.length)];

        // 生成剩余的8位数字
        let phoneNumber = prefix;
        for (let i = 0; i < 8; i++) {
          phoneNumber += Math.floor(Math.random() * 10);
        }

        return phoneNumber;
      }

      data.forEach((da, daIdx) => {
        let obj = {
          sort: `第${daIdx + 1}名`,
          phone: generateRandomPhoneNumber(),
        };
        const mergedObj = { ...da, ...obj };
        console.log("mergedObj",mergedObj);
        data[daIdx] = mergedObj
        // da = mergedObj
      });

      console.log("data",data);
    </script>
  </body>
</html>
